Kameleon-Plus  0.3.2
CCMCTime.h
Go to the documentation of this file.
1 #ifndef CCMC_TIME_H
2 #define CCMC_TIME_H
3 
4 #include <string>
5 #include <iostream>
6 #include <ostream>
7 
8 namespace ccmc
9 {
10  class Time
11  {
12  public:
13 
14  Time(const std::string& epochString);
15  Time(double epoch);
16  Time();
17  ~Time();
18 
19  short getDay() const;
20  void setDay(short day);
21  void setEpoch(double epoch);
22  short getHour() const;
23  void setHour(short hour);
24  short getMilliseconds() const;
25  void setMilliseconds(short milliseconds);
26  short getMinute() const;
27  void setMinute(short minute);
28  short getMonth() const;
29  void setMonth(short month);
30  short getSeconds() const;
31  void setSeconds(double seconds);
32  short getYear() const;
33  void setYear(short year);
34  std::string toString() const;
35  double getEpoch() const; //we use CDF_EPOCH as the underlying data structure
36 
37  private:
38  double epoch;
39  short year;
40  short month;
41  short day;
42  short hour;
43  short minute;
44  short seconds;
45  short milliseconds;
46  void updateEpoch();
47 
48  };
49 
50  std::ostream& operator<<(std::ostream& out, const Time time);
51  double operator-(const Time& time1, const Time& time2);
52  bool operator==(const Time& time1, const Time& time2);
53  bool operator<(const Time& time1, const Time& time2);
54  bool operator>(const Time& time1, const Time& time2);
55  bool operator>=(const Time& time1, const Time& time2);
56 }
57 
58 #endif